//
//  DiscoverRunloopCell.m
//  
//
//  Created by qiuming on 15/12/22.
//
//

#import "DiscoverRunloopCell.h"
#import <Masonry.h>

@interface DiscoverRunloopCell()
// 图片
@property (strong, nonatomic) UIImageView *iconView;
// 指示器
@property (strong, nonatomic) UIPageControl *pageControl;

@end
@implementation DiscoverRunloopCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // 初使化界面
        [self setupUI];
    }
    return self;
}

/// 初使化界面
- (void)setupUI {
    // 添加控件
    [self addSubview:_iconView];
    [self addSubview:_pageControl];
    // 设置布局
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top);
        make.left.equalTo(self.mas_left);
        make.bottom.equalTo(self.mas_bottom);
        make.right.equalTo(self.mas_right);
    }];
    
    [self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_right).with.offset(10);
        make.bottom.equalTo(self.mas_bottom).with.offset(10);
        
    }];
    
}

// MARK: - 懒加载
- (UIImageView *)iconView {
    if (_iconView == nil) {
        _iconView = [[UIImageView alloc]init];
    }
    return _iconView;
}

- (UIPageControl *)pageControl {
    if (_pageControl == nil) {
        _pageControl = [[UIPageControl alloc]init];
        _pageControl.numberOfPages = self.totolCount;
        CGSize size = [_pageControl sizeForNumberOfPages:self.totolCount];
        _pageControl.bounds = CGRectMake(0, 0, size.width, size.height);
        _pageControl.pageIndicatorTintColor = [UIColor whiteColor];
        _pageControl.currentPageIndicatorTintColor = [UIColor redColor];
    }
    return _pageControl;
}







@end
